package com.edu.internship.busi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.edu.internship.busi.dto.CardListDTO;
import com.edu.internship.busi.entity.CardList;
import com.edu.internship.busi.mapper.CardListMapper;
import com.edu.internship.busi.service.ICardListService;
import com.edu.internship.glabal.exception.BusinessException;
import com.edu.internship.util.BeanExUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * [一句话描述该类的功能]
 *
 * @author : tianhuida
 * @version : [v1.0]
 * @createTime : [2022/8/2 9:43]
 */

@Service
@AllArgsConstructor
public class CardListServiceImpl extends ServiceImpl<CardListMapper, CardList> implements ICardListService {

    @Override
    @Transactional(rollbackFor = BusinessException.class)
    public boolean createCard(CardListDTO dto) {
        CardList card = BeanExUtils.convertTo(dto, CardList::new);
        return super.save(card);
    }
}
